<template>
	<view class="settl">
		<view>
			<radio value="r1" :checked="checkAll" color="red" @click="changeState"/>全选</label>	
		</view>
		<view >合计:<text style="color: red;">￥{{getCheckPrice}}</text></view>
		<view class="Clear" @click="toClear">结算({{getCheckNum}})</view>
	</view>
</template>
<script>
	import { mapGetters,mapMutations,mapState} from "vuex"
	export default {
		name:"settlement",
		data() {
			return {
				
			};
		},
		computed:{
			...mapGetters("m_cart",["getCheckNum","getCheckPrice","total"]),
			...mapGetters("m_user",["getAddress"]),
			...mapState('m_cart',["address"]),
			checkAll(){
				return this.total===this.getCheckNum
			},
		},
		methods:{
			...mapMutations("m_cart",["changeAll_GoodsState"]),
			 changeState(){
				 this.changeAll_GoodsState(!this.checkAll)
			 },
			 toClear(){
				 if(!this.getCheckNum) return uni.$showMsg("请选择要结算的商品")
				 if(!this.getAddress) return uni.$showMsg("请选择收货地址")
			 }
		}
	}
</script>
<style scoped>
	.settl{
		display: flex;
		justify-content: space-between;
		border-top: 1px solid rgba(0, 0, 0, 0.3);
		padding:10px 0px 10px 10px;
		align-items: center;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background-color: #f5f5f5;
		z-index: 999;
	}
	.Clear{
		height: 50px;
		width: 120px;
		background-color:#c00000;
		line-height: 50px;
		text-align: center;
		color: white;
	}
</style>